#pragma once
#include "../../Gut/Vertex.h"
#include <glm/glm/glm.hpp>

using namespace Gut;

struct VertexPos
{
    glm::vec3 pos;
    VertexPos() = default;
    VertexPos(const glm::vec3 &p) : pos(p)
    {
    }
    static const std::vector<VertexLayout> inputLayout;
};

struct VertexPosNormalTex
{
    glm::vec3 pos;
    glm::vec3 normal;
    glm::vec2 tex;

    VertexPosNormalTex() = default;
    static const std::vector<VertexLayout> inputLayout;
};


struct VertexPosNormalTexBone2
{
	glm::vec3 pos;
	glm::vec3 normal;
	glm::vec2 tex;

	int bones1[4];
	float weights1[4] = { 0.0f,0.0f,0.0f,0.0f };
	int bones2[4];
	float weights2[4] = { 0.0f,0.0f,0.0f,0.0f };

	VertexPosNormalTexBone2()
	{
		memset(this, 0, sizeof(VertexPosNormalTexBone2));
		
	}
	bool ProcessBone(int bId, float weight, int* bones, float* weights)
	{
		for (int i = 0; i < 4; i++)
		{
			if (weights[i] == 0.0f)
			{
				bones[i] = bId;
				weights[i] = weight;

				return true;
			}
		}

		return false;
	}

	bool AddBoneData(int bId, float w)
	{
		if (ProcessBone(bId, w, bones1, weights1))
			return true;

		if (ProcessBone(bId, w, bones2, weights2))
			return true;
		return false;
	}
	static std::vector<VertexLayout> inputLayout;

};